package zerous.taphero;

import android.app.*;
import android.os.*;
import android.content.*;
import zerous.taphero.util.*;
import android.widget.*;
import java.io.*;
import android.net.*;
import android.view.ViewGroup.*;
import android.view.*;

public class StartActivity extends Activity implements Runnable {
	boolean first;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initData();
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		TextView t = new TextView(this);
		t.setGravity(Gravity.CENTER);
		t.setLayoutParams(new LayoutParams(-1, -1));
		t.setText("Zerous做的");
		setContentView(t);
		t.setTextSize(32);
		
		Item.initItemsData();
		new Handler().postDelayed(this, 500);
		
	}

	@Override
	protected void onPause() {
		// TODO: Implement this method
		super.onPause();
		//Toast.makeText(this, IOHelper.readData(this, "test.dat"), Toast.LENGTH_SHORT).show();
	}
	
	@Override 
	public void run()
	{
		Intent intent = new Intent();
		intent.setClass(this, CharacterSelectActivity.class);
		startActivity(intent); 
		this.finish();
	}
	
	public void initData() {
		if (!IOHelper.myPath.exists()) {
			IOHelper.myPath.mkdir();
		}

		if(!IOHelper.charas.exists()) {
			try {
				IOHelper.charas.createNewFile();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
		if (!new File(IOHelper.myPath, ".profile").exists()) {
			try {
				new File(IOHelper.myPath, ".profile").createNewFile();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
